package com.hliu.core.service.impl;

import com.hliu.core.dao.IBaseMybatisDao;
import com.hliu.core.service.IBaseMybatisService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.Serializable;
import java.util.List;

/**
 * author: 6
 * date: 13-4-9
 */
public abstract class BaseMybatisService<T extends Serializable, PK extends Serializable> implements IBaseMybatisService<T, PK> {
	Logger logger = LoggerFactory.getLogger(BaseMybatisService.class);

	protected IBaseMybatisDao<T, PK> iBaseDao;

	public abstract void setiBaseDao(IBaseMybatisDao<T, PK> iBaseDao);

	@Override
	public T get(String queryKey, PK id) {
		return iBaseDao.get(queryKey, id);
	}

	@Override
	public T load(String queryKey, PK id) {
		return get(queryKey, id);
	}

	@Override
	public void save(String queryKey, T t) {
		iBaseDao.save(queryKey, t);
	}

	@Override
	public void update(String queryKey, T t) {
		iBaseDao.update(queryKey, t);
	}

	@Override
	public List<T> list(String queryKey) {
		return iBaseDao.list(queryKey);
	}

	@Override
	public void deleteObject(String queryKey, T t) {
		iBaseDao.deleteObject(queryKey, t);
	}

	@Override
	public void delete(String queryKey, PK id) {
		iBaseDao.delete(queryKey, id);
	}
}
